#!/bin/env python
#coding=utf-8

import urllib
import urllib2
import socket
import os
import re
import time
from datetime import datetime

#提交函数
def post(url, data):
    data = urllib.urlencode(data)
    req = urllib2.Request(url, data)
    response = urllib2.urlopen(req, timeout=5)
    print response.read()

def main():
    posturl = "http://182.92.170.145:8102/recv/acard"
    data = {}
    data['city'] = '010'
    data['venue'] = 'ff8080814b4684a9014b483e6300043c'
    data['ctm'] = 'pc483e6300043c1'
    data['status'] = 1
    data['cpu'] = 8
    data['memory'] = 40
    data['disk'] = 50
    data['app_live'] = True
    data['app_ver'] = 'V1.0.0'
    data['port_9100'] = True
    data['port_3306'] = True
    data['class_date'] = datetime.date.today().strftime('%Y-%m-%d')
    data['attend_num'] = 256
    post(posturl, data)

if __name__ == '__main__':
    main()
